Ext.define('Admin.view.baseInfo.Map',{
    extend:'Ext.container.Container',
    xtype:'map',
    reference: 'mapBox',
    alias:'map',
    requires: [
        'Admin.common.panel.AgsMap',
        'Admin.common.data.proxy.API'
    ],
    padding: 0,
    cls: "shadow",
    layout: "fit",
    viewModel: "mapModel",
    controller: "mapController",
    height: "100%",
    items: [{
        xtype: "panel",
        reference: "panel",
        title: "实时水雨情",
        width: 360,
        height: 500,
        draggable: true,
        floating: true,
        layout: {
            type: "vbox",
            align: "stretch"
        },
        defaults: {
            flex: 1
        },
        items: [{
            xtype: "map-zqGrid"
        }],
        tbar: {
            layout: {
                type: "hbox",
                align: "stretch"
            },
            items: [{
                xtype: "textfield",
                reference: "searchField",
                emptyText: "输入测站名称搜索",
                flex: 1,
                listeners: {
                    change: "onSearchFieldChange",
                    buffer: 300
                },
                triggers: {
                    clear: {
                        cls: "x-form-clear-trigger",
                        handler: "clearGridFilter",
                        hidden: true
                    },
                    search: {
                        cls: "x-form-search-trigger",
                        weight: 1,
                        handler: "doGridFilter"
                    }
                }
            },
            {
                xtype: "button",
                reference: "btnType",
                text: "河道水情",
                menu: {
                    items: [{
                        text: "雨情",
                        view: "map-pGrid",
                        store: "pStore",
                        params: {
                            reference: "map-pGrid"
                        }
                    },
                    {
                        text: "水库水情",
                        view: "map-zqSkGrid",
                        store: "zqSkStore",
                        params: {
                            reference: "map-zqSkGrid"
                        }
                    },
                    {
                        text: "河道水情",
                        view: "map-zqGrid",
                        store: "zqStore",
                        params: {
                            reference: "map-zqGrid"
                        }
                    },
                    {
                        text: "水质",
                        view: "map-wqGrid",
                        store: "wqStore",
                        params: {
                            reference: "map-wqGrid"
                        }
                    }],
                    listeners: {
                        click: "onBtnMenuClick"
                    }
                }
            }]
        },
        // fbar: {
        //     layout: {
        //         pack: "center"
        //     },
        //     defaults: {
        //         listeners: {
        //             change: "checkLayerVisible"
        //         }
        //     },
        //     items: [{
        //         xtype: "checkbox",
        //         boxLabel: "影像图",
        //         inputValue: "LAYER_MAP"
        //     },"-",{
        //         xtype: "checkbox",
        //         boxLabel: "雨量站",
        //         inputValue: "LAYER_PP"
        //     },
        //     "-", {
        //         xtype: "checkbox",
        //         boxLabel: "水文站",
        //         inputValue: "LAYER_SW",
        //         checked: true
        //     },
        //     "-", {
        //         xtype: "checkbox",
        //         boxLabel: "水质站",
        //         inputValue: "LAYER_WQ"
        //     },
        //     "-", {
        //         xtype: "checkbox",
        //         boxLabel: "流域",
        //         inputValue: "BDLAYER",
        //         checked: true
        //     }]
        // }
    },
    {
        xtype: "agsMap",
        reference: "map",
        listeners: {
            mapInit: "onMapInit"
        }
    },
    {
        xtype: 'panel',
        width: 80,
        height: 80,
        floating: true,
        style: 'border: 3px solid #f00',
        reference: 'layerBtn1',
        html: '<img src="resources/images/fh/layer1.png" style="width: 74px; height: 74px;"/>', 
        listeners: {
            boxready: 'addListenerLayer1'
        }, 
    },
    {
        xtype: 'panel',
        width: 80,
        height: 80,
        floating: true,
        style: 'border: 3px solid #ccc',
        reference: 'layerBtn2',
        html: '<img src="resources/images/fh/layer2.png" style="width: 74px; height: 74px;"/>', 
        listeners: {
            boxready: 'addListenerLayer2'
        }, 
    },
    {
        xtype: 'panel',
        floating: true,
        style: 'border: 1px solid #ccc; z-index: 9999999999;',
        reference: 'map-legend',
        width: 120,
        height: 170,
        layout: 'form',
        defaults: {
            margin: 0,
            padding: 0
        },
        bodyStyle: {
            margin: 0,
            padding: 0
        },
        items: [
            {
                xtype: 'checkboxfield',
                name: 'checkbox1',
                boxLabel: '<div style="font-size: 14px; line-height: 14px;">'+
                '<img  style="margin-right: 5px" src="resources/images/circle.png" />' +
                '雨量站</dvi>',
                listeners: {
                    change: 'PPLayerChange'
                }
            },
            {
                xtype: 'checkboxfield',
                name: 'checkbox1',
                boxLabel: '<div style="font-size: 14px; line-height: 14px;">'+
                '<img  style="margin-right: 5px" src="resources/images/swz.png" />' +
                '水文站</dvi>',
                checked: true,
                listeners: {
                    change: 'SWLayerChange'
                }
            },
            {
                xtype: 'checkboxfield',
                name: 'checkbox1',
                boxLabel: '<div style="font-size: 14px; line-height: 14px;">'+
                '<img  style="margin-right: 5px" src="resources/images/sd.png" />' +
                '水质站</dvi>',
                listeners: {
                    change: 'WQLayerChange'
                }
            },
            {
                xtype: 'checkboxfield',
                name: 'checkbox1',
                boxLabel: '<div style="font-size: 14px; line-height: 14px;">'+
                '<img  style="margin-right: 5px" src="resources/images/ly.png" />' +
                '流域</dvi>',
                checked: true,
                listeners: {
                    change: 'BDLayerChange'
                }
            }
        ],
        listeners: {
            added: 'mapLegendRender'
        }
    }
    ]
});

Ext.define('Admin.view.baseInfo.ZqGrid',{
    extend:'Ext.grid.Panel',
    xtype:'map-zqGrid',
    alias:'map-zqGrid',
    forceFit: true,
    columns: [{
        xtype: "rownumberer"
    },
    {
        text: "站名",
        align: "center",
        dataIndex: "stNm",
        renderer: "stnmRenderer"
    },
    {
        text: "时间",
        align: "center",
        dataIndex: "tm"
    },
    {
        text: "水位m",
        align: "center",
        dataIndex: "z"
    },
    {
        text: "流量m³/s",
        align: "center",
        dataIndex: "q"
    }],
    bind: {
        store: "{zqStore}"
    },
    listeners: {
        itemClick: "gridItemClick"
    }
});

Ext.define('Admin.view.baseInfo.ZqSkGrid',{
    extend:'Ext.grid.Panel',
    xtype:'map-zqSkGrid',
    alias:'map-zqSkGrid',
    forceFit: true,
    columns: [{
        xtype: "rownumberer"
    },
    {
        text: "站名",
        align: "center",
        dataIndex: "stNm",
        renderer: "stnmRenderer"
    },
    {
        text: "时间",
        align: "center",
        dataIndex: "tm"
    },
    {
        text: "库上水位m",
        align: "center",
        dataIndex: "rz"
    },
    {
        text: "入库流量m³/s",
        align: "center",
        dataIndex: "inq"
    },
    {
        text: "出库流量m³/s",
        align: "center",
        dataIndex: "otq"
    }],
    bind: {
        store: "{zqSkStore}"
    },
    listeners: {
        itemClick: "gridItemClick"
    }
});

Ext.define('Admin.view.baseInfo.PGrid',{
    extend:'Ext.grid.Panel',
    xtype:'map-pGrid',
    alias:'map-pGrid',
    forceFit: true,
    columns: [{
        xtype: "rownumberer"
    },
    {
        text: "站名",
        align: "center",
        dataIndex: "stNm",
        renderer: "stnmRenderer"
    },
    {
        text: "日降水量mm",
        align: "center",
        dataIndex: "annP"
    }],
    bind: {
        store: "{pStore}"
    },
    listeners: {
        itemClick: "gridItemClick"
    }
});


Ext.define('Admin.view.baseInfo.WqGrid',{
    extend:'Ext.grid.Panel',
    xtype:'map-wqGrid',
    alias:'map-wqGrid',
    forceFit: true,
    columns: [{
        xtype: "rownumberer"
    },
    {
        text: "站名",
        align: "center",
        dataIndex: "stnm",
        renderer: "stnmRenderer"
    },
    {
        text: "时间",
        align: "center",
        dataIndex: "spt"
    },
    {
        text: "COD",
        align: "center",
        dataIndex: "lttd"
    },
    {
        text: "BOD",
        align: "center",
        dataIndex: "lgtd"
    }],
    bind: {
        store: "{wqStore}"
    },
    listeners: {
        itemClick: "gridItemClick"
    }
});
